OBJECT Codeunit 50002 DynamicShip Extension Skeleton
{
  OBJECT-PROPERTIES
  {
    Date=04/03/20;
    Time=11:20:44 AM;
    Modified=Yes;
    Version List=IW18.11;
  }
  PROPERTIES
  {
    TableNo=23044609;
    OnRun=BEGIN
            //  The below events have the following description blocks in their respective methods:
            //
            //  Desc      : Text          =>  High level description or possible use case
            //  Visibility: User          =>  User can see changes made before finalizing
            //              System        =>  Changes are without user interaction
            //  Origin    : Object.Method =>  Provides details of where the event originates
            //  Trigger   : Text          =>  Provides details as to what user actions trigger it
            //  Handled   : Ignored       =>  System flow will continue
            //              Respected     =>  System flow is circumvented or interrupted
            //                                If not set, changes may be overwritten by the system
            //  Params    : Fields        =>  Data set in trecParam
            //

            trecParam := Rec;

            CASE Rec.Action OF
            //   Rec.Action::"Order Opened": handleOrderOpenedEvent();
            //   Rec.Action::"Pre Build Customs": handlePreBuildCustomsEvent();
            //   Rec.Action::"Post Build Customs": handlePostBuildCustomsEvent();
            //   Rec.Action::"Get Label": handleGetLabelEvent();
            //   Rec.Action::"Ship-To Address": handleShipToAddressEvent();
            //   Rec.Action::"Shipment Options": handleShipmentOptionsEvent();
            //   Rec.Action::Customs: handleCustomsEvent();
            //   Rec.Action::"Package Options": handlePackageOptionsEvent();
            //   Rec.Action::Insurance: handleInsuranceEvent();
            //   Rec.Action::"Selected Rate": handleSelectedRateEvent();
            //   Rec.Action::"Rate Cost": handleRateCostEvent();
            //   Rec.Action::"Rate Price": handleRatePriceEvent();
            //   Rec.Action::"Rate Added": handleRateAddedEvent();
            //   Rec.Action::"Print Internal Pkg Label": handleIntPkgEvent();
            //   Rec.Action::"Print Commercial Invoice": handleCommInvEvent();
            //   Rec.Action::"Completed Rate Shop": handleCompletedRateShopEvent();
            //   Rec.Action::Post: handlePostEvent();
            //   Rec.Action::Scan: handleScanEvent();
            //   Rec.Action::"Get Weight": handleGetWeightEvent();
            //   Rec.Action::"Post Build Package Options": handlePostBuildPkgOptsEvent();
            //   Rec.Action::"Post Build Shipment Options": handlePostBuildShipOptsEvent();
            //   Rec.Action::"Ship To Phone No": handleShipToPhoneNoEvent();
            //   Rec.Action::"Ship From Tax ID": handleShipFromTaxIDEvent();
            //   Rec.Action::"Ship To Tax ID": handleShipToTaxIDEvent();
            //   Rec.Action::"Send E-mail": handleSendEmailEvent();
            //   Rec.Action::"Tracking E-mail Address": handleTrackingEmailEvent();
            //   Rec.Action::"Custom Action": handleCustomActionEvent();
            //   Rec.Action::"After Post": handleAfterPostEvent();
            //   Rec.Action::"Rate Filter": handleRateFilterEvent();
              ELSE EXIT;
            END;

            Rec := trecParam;
          END;

  }
  CODE
  {
    VAR
      trecParam@1000000000 : TEMPORARY Record 23044609;
      cuListMgmt@100000001 : Codeunit 23044600;
      cuPackMgmt@100000002 : Codeunit 23044601;
      cuRateMgmt@100000003 : Codeunit 23044602;
      cuRateSingleton@100000004 : Codeunit 23044608;

    LOCAL PROCEDURE handlePreBuildCustomsEvent@1000000011();
    VAR
      lrecCustomsHeader@1000000001 : Record 23044605;
      lrecCustomsLine@1000000000 : Record 23044606;
    BEGIN
      //  Desc      : Allows circumventing the customs line generation logic.
      //              This can be used to populate your own Customs Line data.
      //              The customs header will already be generated.
      //              The "Post Build Customs" will not fire.
      //  Visibility: User
      //  Origin    : CU603.generateCustoms
      //  Trigger   : Opening the customs card
      //  Handled   : Respected
      //  Params    : Document Type, Document No.

      EXIT;
      // This example sets a description and certifies the customs
      lrecCustomsHeader.SETRANGE("Document Type", trecParam."Document Type");
      lrecCustomsHeader.SETRANGE("Document No.", trecParam."Document No.");
      IF (lrecCustomsHeader.FINDFIRST()) THEN BEGIN
        lrecCustomsHeader."Content Explanation" := 'Standard description';
        lrecCustomsHeader.certify(FALSE);
      END;
    END;

    LOCAL PROCEDURE handlePostBuildCustomsEvent@1000000012();
    VAR
      lrecCustomsHeader@1000000000 : Record 23044605;
      lrecCustomsLine@1000000001 : Record 23044606;
    BEGIN
      //  Desc      : Allows altering generated customs lines
      //              The customs header and appropriate lines will exist.
      //  Visibility: User
      //  Origin    : CU603.generateCustoms
      //  Trigger   : Opening the customs card
      //  Handled   : Ignored
      //  Params    : Document Type, Document No.

      EXIT;
      // This examples set the line value to 0.01
      lrecCustomsHeader.SETRANGE("Document Type", trecParam."Document Type");
      lrecCustomsHeader.SETRANGE("Document No.", trecParam."Document No.");
      IF (lrecCustomsHeader.FINDFIRST()) THEN BEGIN
        lrecCustomsLine.SETRANGE("Customs No.", lrecCustomsHeader."No.");
        IF (lrecCustomsLine.FINDSET(TRUE)) THEN BEGIN
          REPEAT
            lrecCustomsLine."Value Per Item Qty." := 0.01;
            lrecCustomsLine.MODIFY(FALSE);
          UNTIL(lrecCustomsLine.NEXT=0);
      END;
      END;
    END;

    LOCAL PROCEDURE handleGetLabelEvent@1000000000();
    VAR
      lrecSalesHeader@1000000000 : Record 36;
      lrecTransferHeader@1000000001 : Record 5740;
      lrecPurchaseHeader@1000000003 : Record 38;
      lrecWhseShipLine@1000000002 : Record 7321;
    BEGIN
      //  Desc      : Allows circumventing the entire dship logic for rate shopping
      //              Could also be used to perform pre-checks and/or config changes.
      //              No further events will fire
      //  Visibility: User
      //  Origin    : CU602.getShippingLabel
      //  Trigger   : Launching the GetLabel action
      //  Handled   : Respected
      //  Params    : Document Type, Document No.

      EXIT;
      // This case structure is an example to filter down to the document
      CASE trecParam."Document Type"  OF
        // if not using whse shipments
        trecParam."Document Type"::"Sales Order":
          BEGIN
            lrecSalesHeader.GET(1, trecParam."Document No.");
            // do stuff
          END;
        trecParam."Document Type"::"Outbound Transfer":
          BEGIN
            lrecTransferHeader.GET(trecParam."Document No.");
            // do stuff
          END;
        // if using whse shipments
        trecParam."Document Type"::"Warehouse Shipment":
          BEGIN
            lrecWhseShipLine.SETRANGE("No.", trecParam."Document No.");
            IF ( lrecWhseShipLine.FINDFIRST ) THEN BEGIN
              CASE lrecWhseShipLine."Source Document" OF
                 lrecWhseShipLine."Source Document"::"Sales Order":
                   BEGIN
                      lrecSalesHeader.GET(lrecWhseShipLine."Source Subtype", lrecWhseShipLine."Source No.");
                     // do stuff
                   END;
                lrecWhseShipLine."Source Document"::"Purchase Return Order":
                   BEGIN
                     lrecPurchaseHeader.GET(lrecWhseShipLine."Source Subtype", lrecWhseShipLine."Source No.");
                     // do stuff
                   END;
                lrecWhseShipLine."Source Document"::"Outbound Transfer":
                   BEGIN
                     lrecTransferHeader.GET(lrecWhseShipLine."Source No.");
                     // do stuff
                   END;
               END; // case lrecwhseshipline
            END; // if lrecwhseshipline.findfirst
          END;
      END; // case trecParam

      // if (bDidStuff) THEN
      //   trecParam.Handled := trecParam.Handled::Yes;
    END;

    LOCAL PROCEDURE handleShipToAddressEvent@1000000001();
    BEGIN
      //  Desc      : Allows overwriting the destination address ship-to
      //              The ship-to must belong to the same customer
      //  Visibility: User
      //  Origin    : CU602.setShipToAddressForSalesOrder
      //  Trigger   : Fires when an address for a SO is retrieved from the DB
      //  Handled   : Respected
      //  Params    : Document Type, Document No.

      EXIT;
      // This simple example demonstrates what fields to set
      trecParam."Ship-To Code" := 'new code';
      trecParam.Handled := trecParam.Handled::Yes;
    END;

    LOCAL PROCEDURE handleShipmentOptionsEvent@1000000002();
    VAR
      lrecShipmentOptions@1000000000 : Record 23044616;
    BEGIN
      //  Desc      : Allows silently overwriting Shipment Options
      //  Visibility: System
      //  Origin    : CU609.getShipRates (private)
      //  Trigger   : Fires before the EasyPost API request is made
      //  Handled   : Ignored
      //  Params    : Document Type, Document No.

      EXIT;
      // Additional processing for residential deliveries
      IF (lrecShipmentOptions.GET(trecParam."Document Type", trecParam."Document No.") AND
          (lrecShipmentOptions."Residential Delivery" = lrecShipmentOptions."Residential Delivery"::Yes))
      THEN BEGIN
        // add extra charges
      END;
    END;

    LOCAL PROCEDURE handleCustomsEvent@1000000003();
    VAR
      lrecCustomsHeader@1000000000 : Record 23044605;
      lrecCustomsLine@1000000001 : Record 23044606;
    BEGIN
      //  Desc      : Allows silently overwriting Customs Header/Lines
      //  Visibility: System
      //  Origin    : CU609.getShipRates (private)
      //  Trigger   : Fires before the EasyPost API request is made
      //  Handled   : Ignored
      //  Params    : Document Type, Document No.

      EXIT;
      // Sets the EEL/EEI/AES/B13A
      lrecCustomsHeader.SETRANGE("Document Type", trecParam."Document Type");
      lrecCustomsHeader.SETRANGE("Document No.", trecParam."Document No.");
      IF (lrecCustomsHeader.FINDFIRST()) THEN BEGIN
        lrecCustomsHeader."EEL PFC" := 'NOEEI 30.37(a)';
        lrecCustomsHeader.MODIFY(FALSE);
      END;
    END;

    LOCAL PROCEDURE handlePackageOptionsEvent@1000000004();
    VAR
      lrecPackageOptions@1000000000 : Record 23044608;
    BEGIN
      //  Desc      : Allows silently overwriting Package Options
      //              Fires for each License Plate
      //  Visibility: System
      //  Origin    : CU609.getShipRates (private)
      //  Trigger   : Fires before the EasyPost API request is made
      //  Handled   : Ignored
      //  Params    : License Plate No., Document Type, Document No.

      EXIT;
      // If additional handling is set, pass instructions
      IF (lrecPackageOptions.GET(trecParam."License Plate No.") AND
          (lrecPackageOptions."Additional Handling" = lrecPackageOptions."Additional Handling"::Yes))
      THEN BEGIN
        lrecPackageOptions."Handling Instructions" := 'Fragile glassware.';
        lrecPackageOptions.MODIFY(FALSE);
      END;
    END;

    LOCAL PROCEDURE handleInsuranceEvent@1000000005();
    VAR
      lrecLPHeader@1000000000 : Record 23044505;
    BEGIN
      //  Desc      : Allows silently overwriting Insurance
      //              Fires for each License Plate
      //  Visibility: System
      //  Origin    : CU609.getShipRates (private)
      //  Trigger   : Fires before the EasyPost API request is made
      //  Handled   : Ignored
      //  Params    : License Plate No., Document Type, Document No.

      EXIT;
      // Apply different summing rules depending on setting
      lrecLPHeader.GET(trecParam."License Plate No.");
      CASE lrecLPHeader."Insurance Value Handling" OF
        lrecLPHeader."Insurance Value Handling"::Never:
          BEGIN
            lrecLPHeader."Insurance Amount" := 0;
          END;
        lrecLPHeader."Insurance Value Handling"::"Content Cost":
          BEGIN
          END;
        lrecLPHeader."Insurance Value Handling"::"Content Price":
          BEGIN
          END;
        lrecLPHeader."Insurance Value Handling"::Custom:
          BEGIN
            lrecLPHeader."Insurance Amount" := 500;
          END;
      END;
      lrecLPHeader.MODIFY(FALSE);
    END;

    LOCAL PROCEDURE handleSelectedRateEvent@1000000006();
    BEGIN
      //  Desc      : Allows handling the cost of the freight, circumventing DShip's
      //  Visibility: System
      //  Origin    : CU602.addRateToOrder
      //  Trigger   : Fires after the rate was selected.
      //  Handled   : Respected
      //  Params    : Document Type, Document No., Rate
    END;

    LOCAL PROCEDURE handleCompletedRateShopEvent@1000000007();
    BEGIN
      //  Desc      : Used to update other data points with the now updated DShip data.
      //  Visibility: System
      //  Origin    : CU602.getShippingLabel
      //  Trigger   : When rate shopping is complete
      //  Handled   : Ignored
      //  Params    : Document Type, Document No.
    END;

    LOCAL PROCEDURE handlePostEvent@1000000008();
    BEGIN
      //  Desc      : Allows circumventing the DShip posting procedure
      //  Visibility: System
      //  Origin    : CU600.postOrder
      //  Trigger   : Posting from Order Packaging or the Package Worksheet
      //  Handled   : Respected
      //  Params    : Document Type, Document No.
    END;

    LOCAL PROCEDURE handleScanEvent@1000000009();
    BEGIN
      //  Desc      : Can be used for custom commands, custom barcode decodes
      //              Processing master serials or other custom non-standard values
      //              If "Scan Value" is altered, it will carry forward, even if handled is not set
      //  Visibility: System
      //  Origin    : P602.processScan (private)
      //  Trigger   : After text is entered/scanned into the Package Worksheet
      //  Handled   : Respected
      //  Params    : Document Type, Document No., Scan Value, Item No. (optional), License Plate No. (optional)
    END;

    LOCAL PROCEDURE handleGetWeightEvent@1000000010();
    BEGIN
      //  Desc      : Circumvent the built in scale management or use custom entry pages
      //  Visibility: System
      //  Origin    : P602.getWeight (private)
      //  Trigger   : When the GetWeight action is launched
      //  Handled   : Respected
      //  Params    : Document Type, Document No., License Plate No.
    END;

    LOCAL PROCEDURE handlePostBuildPkgOptsEvent@1000000013();
    BEGIN
      //  Desc      : Allows for further Package Options ammendments
      //  Visibility: User
      //  Origin    : CU601.createPackOptions
      //  Trigger   : After the template (if any) is applied
      //  Handled   : Ignored
      //  Params    : Document Type, Document No., License Plate No.
    END;

    LOCAL PROCEDURE handlePostBuildShipOptsEvent@1000000014();
    BEGIN
      //  Desc      : Allows for further Shipment Options ammendments
      //  Visibility: User
      //  Origin    : CU601.createShipOptions
      //  Trigger   : After the template (if any) is applied
      //  Handled   : Ignored
      //  Params    : Document Type, Document No.
    END;

    LOCAL PROCEDURE handleShipToPhoneNoEvent@1000000016();
    BEGIN
      //  Desc      : Allows altering the phone number for the destination address.
      //              The number is sent directly to the API and not displayed to the user.
      //              Bad numbers will still generate errors.
      //  Visibility: System
      //  Origin    : CU602.setPrereqs
      //  Trigger   : When the address is retrieved to be sent to the carrier
      //  Handled   : Respected
      //  Params    : Document Type, Document No., Scan Value (phone number)
    END;

    LOCAL PROCEDURE handleShipFromTaxIDEvent@1000000015();
    VAR
      lrecCompanyInfo@100000000 : Record 79;
    BEGIN
      //  Desc      : Allows adding a tax id to the ship from address
      //              Insert the tax id into Scan Value
      //              Insert the type F/S (federal/state) into Item No.
      //  Visibility: System
      //  Origin    : CU602.setPrereqs
      //  Trigger   : When the address is retrieved to be sent to the carrier
      //  Handled   : Respected
      //  Params    : Document Type, Document No.

      EXIT;

      // code to get tax id for shipper
      // Can use trecParam."Document Type" and trecParam."Document No." to retrieve source document
      // to, for example, get the location, access it's card, pull the id from a field
      // or, potentially, get it off of the company card, g/l setup, or somewhere else
      // =>

      lrecCompanyInfo.GET();
      trecParam."Scan Value" := lrecCompanyInfo."VAT Registration No."; // or retrieved elsewhere as above
      trecParam."Item No." := 'F'; // implies above Tax ID is federal // or 'S' for state tax IDs
      trecParam.Handled := trecParam.Handled::Yes;
    END;

    LOCAL PROCEDURE handleShipToTaxIDEvent@1000000017();
    BEGIN
      //  Desc      : Allows adding a tax id to the ship to address
      //              Insert the tax id into Scan Value
      //              Insert the type F/S (federal/state) into Item No.
      //  Visibility: System
      //  Origin    : CU602.setPrereqs
      //  Trigger   : When the address is retrieved to be sent to the carrier
      //  Handled   : Respected
      //  Params    : Document Type, Document No.
    END;

    LOCAL PROCEDURE handleCommInvEvent@1000000019();
    BEGIN
      //  Desc      : Allows injecting in the Commercial Invoice print.
      //              Either to replace, prevent, or print additional reports.
      //              The License Plate is the first in the series and must be used to filter.
      //  Visibility: User
      //  Origin    : CU601.printCommercialInvoiceByLP
      //  Trigger   : When the system prints the Commercial Invoice
      //  Handled   : Respected
      //  Params    : License Plate No.
    END;

    LOCAL PROCEDURE handleIntPkgEvent@1000000018();
    BEGIN
      //  Desc      : Allows injecting in the Internal Package Label print.
      //              Either to replace, prevent, or print additional reports.
      //  Visibility: User
      //  Origin    : CU601.printInternalPackageLabel
      //  Trigger   : When the system prints the Internal Package Label
      //  Handled   : Respected
      //  Params    : Document Type, Document No.
    END;

    LOCAL PROCEDURE handleOrderOpenedEvent@1000000020();
    BEGIN
      //  Desc      : Allows altering line data before it is read into the package worksheet.
      //              This could implement autopack or auto-unpack.
      //              Other order processing or checks required before packing.
      //  Visibility: User
      //  Origin    : P602.initPage
      //  Trigger   : Selecting an order from Order Packaging
      //              Scanning an order or LP (on a different order) in the Package Worksheet
      //  Handled   : Ignored
      //  Params    : Document Type, Document No.
    END;

    LOCAL PROCEDURE handleTrackingEmailEvent@1000000021();
    VAR
      lrecSalesHeader@1000000000 : Record 36;
    BEGIN
      // Triggers when the
      //  Desc      : Allows replacing the receiver email address
      //              Insert the email into Scan Value
      //  Visibility: System
      //  Origin    : CU606.initEmailBuffer
      //  Trigger   : When the email is created
      //  Handled   : Respected
      //  Params    : Document Type, Document No.

      EXIT;
      // Example to replace email
      CASE trecParam."Document Type" OF
        trecParam."Document Type"::"Sales Order":
          BEGIN
            lrecSalesHeader.GET(1, trecParam."Document No.");
            // logic to determine email
            trecParam."Scan Value" := 'new email';
          END;
        trecParam."Document Type"::"Outbound Transfer":
          BEGIN
          END;
        trecParam."Document Type"::"Warehouse Shipment":
          BEGIN
          END;
      END;

      trecParam.Handled := trecParam.Handled::Yes;
    END;

    LOCAL PROCEDURE handleSendEmailEvent@1000000022();
    BEGIN
      //  Desc      : Allows replacing the built in email handling
      //  Visibility: System
      //  Origin    : CU602.getShippingLabel
      //  Trigger   : Before the email is created
      //  Handled   : Respected
      //  Params    : Document Type, Document No.
    END;

    LOCAL PROCEDURE handleRateCostEvent@1000000023();
    BEGIN
      //  Desc      : Allows circumventing DShip Freight Price Rules
      //              Rate and Rate Line Discount can be populated
      //  Visibility: System
      //  Origin    : CU602.getSplitRateForSourceDoc
      //  Trigger   : Before the Freight Price Rules are applied
      //  Handled   : Respected
      //  Params    : Document Type, Document No., Rate, Scan Value (Rate Id)
    END;

    LOCAL PROCEDURE handleRatePriceEvent@1000000024();
    BEGIN
      //  Desc      : Allows additional manipulation of Rate Price after Rules are applied
      //              This includes any rules applied in Rate Cost
      //              The Item No. contains the Freight Price Entry No.
      //              This can be used to reference the rule that was applied, e.g. get carrier
      //  Visibility: System
      //  Origin    : CU602.getSplitRateForSourceDoc
      //  Trigger   : After the Freight Price Rules are applied
      //  Handled   : Ignored
      //  Params    : Document Type, Document No., Rate, Rate Line Discount, Item No. (Freight Price Rule Entry No)
    END;

    LOCAL PROCEDURE handleRateAddedEvent@1000000026();
    BEGIN
      //  Desc      : Allows manipulating the freight line after it has been added/updated.
      //              The Document Type and No. refer specifically to the Sales Order
      //  Visibility: System
      //  Origin    : CU602.addRateToOrder
      //  Trigger   : After the rate has been added/updated on the order
      //  Handled   : Ignored
      //  Params    : Document Type, Document No.
    END;

    LOCAL PROCEDURE handleCustomActionEvent@1000000025();
    BEGIN
      //  Desc      : Allows implementing custom actions tied to --actionN as well as page actions
      //  Visibility: User
      //  Origin    : P602.runCustomAction
      //  Trigger   : User scan or click
      //  Handled   : Ignored
      //  Params    : License Plate No., Document Type, Document No., Rate (action number)

      CASE trecParam.Rate OF
        1:
          BEGIN
            // handling for custom action 1
          END;
        2:
          BEGIN
          END;
        3:
          BEGIN
          END;
        4:
          BEGIN
          END;
        5:
          BEGIN
          END;
        ELSE
          EXIT;
      END; //case
    END;

    LOCAL PROCEDURE handleAfterPostEvent@100000000();
    BEGIN
      //  Desc      : Allows performing additional actions after posting
      //  Visibility: System
      //  Origin    : CU600.postOrder
      //  Trigger   : Posting from Order Packaging or the Package Worksheet
      //  Handled   : Ignored
      //  Params    : Document Type, Document No.
    END;

    LOCAL PROCEDURE handleRateFilterEvent@100000001();
    VAR
      ltrecSelectedRate@100000001 : TEMPORARY Record 23044603;
      ltrecRateBuffer@100000000 : TEMPORARY Record 23044603;
    BEGIN
      //  Desc      : Allows filtering the rates/services shown in the Rate Worksheet
      //              Allows setting the selected rate, must set handled to yes (and vice versa)
      //  Visibility: User
      //  Origin    : CU602.getSelectedRateData
      //  Trigger   : Calling Get Label from Order Packaging, Package Worksheet, or programmatically
      //  Handled   : Respected
      //  Params    : Document Type, Document No.

      EXIT;

      cuRateSingleton.getRateBuffer(ltrecRateBuffer);

      // please note that these are API provided values that could change in the future by the carrier
      // you should not hardocde values here. Use the extended config and get details from config tables
      // look up the carrier id in the DSHIP Carrier table based on the NAV shipping agent code
      // and look up the service in the DSHIP Carrier Service to get the API value 'service'
      ltrecRateBuffer.SETRANGE(Service, 'Preferred Service');
      ltrecRateBuffer.SETRANGE("Carrier Account ID", 'ca_12345');
      ltrecRateBuffer.SETRANGE("Carrier Name", 'UPS');

      // if the carrier provided cost is sub 50
      ltrecRateBuffer.SETRANGE("Rate Cost", 0, 50);

      // set it as the selected rate
      IF (ltrecRateBuffer.FINDFIRST()) THEN BEGIN
        ltrecSelectedRate.COPY(ltrecRateBuffer);
        ltrecSelectedRate.INSERT(FALSE);
        cuRateSingleton.setSelectedRate(ltrecSelectedRate);
        // since we set a selected rate, we must set handled to yes
        // otherwise the selection will be discarded.
        trecParam.Handled := trecParam.Handled::Yes;
        EXIT;
      END;

      // otherwise delete all rates exceeding 100 dollars
      ltrecRateBuffer.RESET();
      ltrecRateBuffer.SETRANGE("Rate Cost", 100, 99999);
      ltrecRateBuffer.DELETEALL(FALSE);

      cuRateSingleton.setRateBuffer(ltrecRateBuffer);
      // do not set handled, or you will generate an error.
    END;

    BEGIN
    {
      ************************
      Copyright Notice
      This objects content is copyright of Insight Works 2011.  All rights reserved.
      Any redistribution or reproduction of part or all of the contents in any form is prohibited.
      ************************


      <IW>
        <REVISION author="M.Matthiesen" date="01/01/2018" version="IW18.01" issue="DSHIP-EXT">
          DShip Extension events.
        </REVISION>
      </IW>
    }
    END.
  }
}

